package models

import com.jfinal.plugin.activerecord.Model

class UserInfoM: Model<UserInfoM>() {

    companion object{
        val AGENT by lazy {
            UserInfoM()
        }
        const val TABLE_NAME = "user_info"
        const val ID = "id"
        const val USER_ID = "user_id"
        const val NICK_NAME = "nick_name"
        const val SIGN = "sign"
        const val AVATAR = "avatar"
        const val SEX = "sex"
        const val BIRTHDAY = "birthday"
        const val STU_ID = "stu_id"
        const val COLLEGE = "college"
        const val SCHOOL = "school"

        fun findInfobyUserId(userId: Int): UserInfoM{
            return AGENT.findFirst("select * from $TABLE_NAME where $USER_ID = $userId")
        }
    }
}